package com.yusong.test.beanFactoryPost;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by yusong on 2017/3/9.
 * BeanDefinitionRegistryPostProcessor早于BeanFactoryPostProcessor执行
 */
@Service
public class MyBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {

    //先执行
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
        System.out.println("MyBeanDefinitionRegistryPostProcessor:postProcessBeanDefinitionRegistry:"+new Date());
    }

    //后执行
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("MyBeanDefinitionRegistryPostProcessor:postProcessBeanFactory:"+new Date());
    }
}
